<?php if (! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Uc登陆注册 控制器
 */
class Uc extends Front_Controller {

    public function __construct() {
        parent::__construct();
        log_message('debug', "Uc Controller Class Initialized");
    }

    public function index() {
        $this->load->library('session');
        $data = array();
        $data['user'] = $this->session->userdata('user');
        $this->load->view('demo/uc_index', $data);
    }

    /**
     * 注册演示
     */
    public function reg() {
        $this->load->library('form_validation');
        //$this->form_validation->set_rules('username', '用户账号', 'required');
        //$this->form_validation->set_rules('password', '用户密码', 'required');
        //$this->form_validation->set_rules('repassword', '确认密码', 'required|matches[password]');
        $this->form_validation->set_rules('email', '用户邮箱', 'valid_email');

        if ($this->form_validation->run() == false) {
            $data = array();
            $this->load->view('demo/uc_reg', $data);
        } else {
            $post = $this->input->post(null, true);

            $this->load->library('uc/uc_api');
            $uc_uid = $this->uc_api->user_register($post['username'], $post['password'], $post['eamil']);
            var_dump($uc_uid);
        }
    }

    /**
     * 验证用户名
     */
    public function check_username() {

    }

    /**
     * 验证密码
     */
    public function check_password() {

    }

    /**
     * 验证密码强度
     */
    public function check_pwd_strong() {

    }

    /**
     * 验证Email
     */
    public function check_email() {

    }

    /**
     * 验证手机号码
     */
    public function check_mobile() {

    }

    /**
     * 验证验证码
     */
    public function check_captcha() {

    }
}

/* End of file uc.php */
/* Location: ./application/controllers/demo/uc.php */
